<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@include file="/WEB-INF/jsp/include/tags.jsp"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>profile - list</title>
<link rel="stylesheet" type="text/css" href="/css/style.css" />
<script type="text/javascript">
	<!--
		function goPage(page) {
			var f = document.profileCriteriaForm;
			f.action = '/profile.do';
			f.method = 'get';
			f.elements["mode"].value = "list";
			f.elements["paging.currentPage"].value = page;
			f.submit();
		}
		
		function search() {
			var f = document.profileCriteriaForm;
			f.action = '/profile.do';
			f.method = 'get';
			f.elements["mode"].value = "list";
			f.elements["paging.currentPage"].value = 0;
			f.submit();
		}
		
		function goDetail(userid) {
			var f = document.profileCriteriaForm;
			f.action = '/profile.do';
			f.method = 'get';
			f.elements["mode"].value = "detail";
			f.elements["userid"].value = userid;
			f.submit();
		}
		
		function goWrite() {
			var f = document.profileCriteriaForm;
			f.action = '/profileWrite.do';
			f.method = 'get';
			f.elements["mode"].value = "write";
			f.submit();
		}
	//-->
	</script>
</head>
<body>

	<p>
		<a href="/">home</a>
	</p>

	<h1>Profile - list</h1>

	<form:form commandName="profileCriteria" id="profileCriteriaForm"
		name="profileCriteriaForm" action="/profile.do" method="get">
		<input type="hidden" name="mode" />
		<form:hidden path="userid" />
		<form:hidden path="paging.currentPage" />
	</form:form>

	<div>${profileCriteria.paging.totalResults} results.</div>

	<table width="800">
		<colgroup width="800">
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
			<col width="*" />
		</colgroup>
		<tr>
			<th>userid</th>
			<th>langpref</th>
			<th>favcategory</th>
			<th>mylistopt</th>
			<th>banneropt</th>
		</tr>
		<c:forEach var="profile" items="${profileList}">
			<tr>
				<td><a href="javascript:goDetail('${profile.userid}');"> <c:out
							value="${profile.userid}" />
				</a></td>
				<td><c:out value="${profile.langpref}" /></td>
				<td><c:out value="${profile.favcategory}" /></td>
				<td><c:out value="${profile.mylistopt}" /></td>
				<td><c:out value="${profile.banneropt}" /></td>
			</tr>
		</c:forEach>
	</table>

	<div>
		<c:set var="paging" value="${profileCriteria.paging}" />
		<%@ include file="/WEB-INF/jsp/include/paging/default.jsp"%>
	</div>

	<p />

	<a href="<c:url value='javascript:goWrite();'/>">write</a>
	<a href="<c:url value='/profile.do'/>">list</a>

</body>
</html>
